<template >
  <div id="homebox"  >
    <el-container style="height:100%;" direction="vertical">
      <el-header height="70px" style="width: 100%;"><navindex ref="NavIndex  "></navindex></el-header>
      <el-container>
        <el-aside width="300px" style=" display: block;position: absolute;left: 0;top: 70px; bottom: 0;">
          <sidebar ref="sidebar" @download="download" @addPoint="addPoint"
           @setMainView="setMainVeiw($event)"></sidebar></el-aside>
        <el-main style="background-color: white; position: absolute;left: 300px;right: 0;top: 70px;bottom: 0;padding: 0" >
          <component :is=mainview ref="Map" @setPoint="setPoint(arguments)"></component></el-main>
      </el-container>
    </el-container>
    <router-view></router-view>
  </div>
</template>

<script>
import sidebar from "@/components/sidebar/sidebar";
import Navindex from "@/components/navigation/Navindex";
import Map from "@/components/navigation/Map";
import PointList from "@/components/pointlist/PointList";

export default {
  name: "Home",
  components: {sidebar, Navindex,Map,PointList},
  data(){
    return{
      mainview:'Map'
    }
  },
  methods:{
   download(){
     this.$refs["Map"].map()
   },
    addPoint(){
      this.$refs['Map'].addMapEvent();
    },
    setPoint(msg){
     console.log(msg[0],msg[1])
     this.$refs['sidebar'].setPoint(msg[0],msg[1]);
    },
    setMainVeiw(msg){
     this.mainview=msg;
    }

  }
}
</script>

<style scoped>
html,body,#app,#homebox,.el-container{
  padding: 0;
  margin: 0;
  height:100%
}
.el-header, .el-footer {
  padding: 0;
  text-align: center;
  height: 70px;
}

.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
}

.el-main {
  border: 8px solid #bcdeb3;
  border-radius: 5px;
  background: #F9F0DA;
  color: #9E9C9C
}

body > .el-container {
  margin-bottom: 40px;
}

</style>
